package com.lagou.work.task03.angel.jobService.impl.dome;

import com.lagou.work.task03.angel.jobService.clientService.JobClientBase;
import com.lagou.work.task03.angel.utils.IOUtil;

import java.io.FileInputStream;
import java.io.IOException;
import java.io.OutputStream;
import java.net.Socket;

/**
 * @author：dingyuan
 * @date：2022.4.1 19:46
 * @description：继承 客户端功能抽象类，自定义实现分布式计算客户端功能
 */
public class JobClientDemo extends JobClientBase {

    // 启动client Job
    public static void main(String[] args) throws Exception {
        new JobClientDemo().run(args);
    }

    @Override
    public void handleJob(Socket jobClient) throws Exception {
        FileInputStream fis = null;
        OutputStream outputStream = null;
        try {
            String path = "D://BubbleSort.class";
            fis = new FileInputStream(path);
            outputStream = jobClient.getOutputStream();
            IOUtil.handleIOStream(fis, outputStream);

        } catch (IOException e) {
            e.printStackTrace();
        }finally {
            IOUtil.close(jobClient, null);
        }
    }
}
